﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

/// <summary>
///DesktopService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。 
[System.Web.Script.Services.ScriptService]
public class DesktopService : System.Web.Services.WebService
{

	public DesktopService()
	{
		//如果使用设计的组件，请取消注释以下行 
		//InitializeComponent(); 
	}

	/// <summary>
	/// 设置桌面的卡片
	/// </summary>
	/// <param name="orders">卡片的顺序，以逗号分隔</param>
	/// <returns></returns>
	[WebMethod(EnableSession = true)]
	public void SetCards(string orders)
	{
		using (var pm = new PBOffice.BLL.PluginsManager())
			pm.SaveDesktop(Session["userManage"] as PBOffice.DAL.User, orders);
	}

	/// <summary>
	/// 获取当前时间
	/// </summary>
	/// <returns></returns>
	[WebMethod]
	public string GetNowTime() 
	{
		return DateTime.Now.ToLongDateString() + " " + (DayOfWeek)DateTime.Now.DayOfWeek+" "+DateTime.Now.ToLongTimeString();
	}

	enum DayOfWeek
	{
		星期日,
		星期一,
		星期二,
		星期三,
		星期四,
		星期五,
		星期六
	}
}
